package com.kefu.call.vo;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.call.model.ActivityInventoryInfo;
import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author francis
 * @date 2021/05/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "活动清单")
public class ActivityInventoryInfoInsertVo extends AbstractInsertVo<ActivityInventoryInfo> {

	@NotEmpty
    @Size(max = 32)
    @ApiModelProperty(value = "活动ID")
    private String activityId;
	@NotNull
    @Size(max = 50)
    @ApiModelProperty(value = "清单名称",notes="建议取名为 活动名称-客户名称")
    private String inventoryName;
    @ApiModelProperty(value = "数据状态0 无效，1有效",hidden=true)
    private Integer dataStatus=1;
    @Size(max = 32)
    @ApiModelProperty(value = "所属用户")
    private String userId;
    @Size(max = 32)
    @ApiModelProperty(value = "所属用户")
    private String userName;
    @Size(max = 32)
    @ApiModelProperty(value = "客户ID")
    private String customerId;
    @NotEmpty
    @Size(max = 32)
    @ApiModelProperty(value = "客户名称")
    private String customerName;
    
    @ApiModelProperty(value = "客户电话")
    private String customerPhone;
    @ApiModelProperty(value = "预约时间")
    private Long reserveTime;
    @Size(max = 32)
    @ApiModelProperty(value = "联系计划ID")
    private String planId;

    @Override
    public ActivityInventoryInfo convert() {
        ActivityInventoryInfo info = new ActivityInventoryInfo();
	    info.setActivityId(activityId);
	    info.setInventoryName(inventoryName);
	    info.setDataStatus(dataStatus);
	    info.setUserId(userId);
	    info.setUserName(userName);
	    info.setInventoryStatus(1);
	    info.setAssignmentStatus(1);
	    info.setIntentionStatus(0);
	    info.setCustomerId(customerId);
	    info.setCustomerName(customerName);
	    info.setReserveTime(reserveTime);
	    info.setPlanId(planId);
	    info.setCustomerPhone(customerPhone);
        KefuContext context = KefuContext.getKefuContext();
		info.setInventoryId(IdUtil.simpleUUID());
	    info.setCreateTime(context.getNow());
	    info.setCreateUser(context.getUserId());
	    info.setUpdateTime(context.getNow());
	    info.setUpdateUser(context.getUserId());
	    info.setTenantId(context.getTenantId());
	    return info;
	}
}